#include <s:\packages\xml\MSXML2_tlb.h>
#include "exemple ContentHandler.h"

void __fastcall cModeleSpecifique::Import_GT4(const AnsiString &Fichier,)
{
  HRESULT hResInit = CoInitialize(NULL);
  try{
    if( (hResInit != S_OK) && (hResInit != S_FALSE)) throw EUser( TAGL, "CoInitialize failed");
    HRESULT hr;
	// Initialisation de l'objet COM de lecture XML
    ISAXXMLReaderPtr pReader;
    CHR(pReader.CreateInstance(CLSID_SAXXMLReader));//__uuidof(SAXXMLReader)));

	// Initialisation de l'objet COM recevant les évènements (balises attributs ...)
    GT4_ContentHandler * pGT4_ContentHandler = GT4_ContentHandler::CreateInstance( this, Fichier);
    CHR(pReader->putContentHandler(pGT4_ContentHandler));

	//parsage du XML
    CHR(pReader->parseURL(WideString(Fichier).c_bstr()));
	  
    	// remise à NULL du ContentHandler
    GT4_ContentHandler *pGT4_ContentHandlerNULL = NULL;
    CHR(pReader->putContentHandler( pGT4_ContentHandlerNULL));   pGT4_ContentHandler = NULL;
  }__finally{
    if( hResInit == S_OK)
      CoUninitialize();
  }
}
